#include <stdio.h>
#include <stdlib.h>

#define N 100


#define h(x) (1LL * (x) * (x) * (x) * (x) * (x))
int a[6];
long long H[1 + N] = {0LL};

void fill() {
    int i;
    for (i = 1; i <= N; i++) H[i] = 1LL * i * i * i * i * i;
}

long long key, *p;

int cmp(const void *a, const void *b) {
    long long flag = *(long long *) a - *(long long *) b;
    if (flag > 0) return 1;
    if (flag < 0) return -1;
    return 0;
}

void dfs(int k, int t) {//带范围的dfs改造可以避免重复值
    if (k == 5) {//搜到5层结束
        key = H[a[0]] + H[a[1]] + H[a[2]] + H[a[3]] + H[a[4]];
        p = (long long *) bsearch(&key, H + 1, N, sizeof(H[0]), cmp);
        if (p)
            printf("%d %d %d %d %d %d\n", a[0], a[1], a[2], a[3], a[4],
                   (int) (p - H));
        return;
    }
    for (int i = t; i < N; i++) {
        a[k] = i;
        dfs(k + 1, i);//当前选择的下表已经是i,以后的数下标不可以小于i
    }
}

int main() {
    fill();
    dfs(0, 1);
}